import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrdersReturnVO, OrdersReturnForm, OrdersReturnQuery } from '@/api/order/ordersReturn/types';

/**
 * 查询单据回访列表
 * @param query
 * @returns {*}
 */

export const listOrdersReturn = (query?: OrdersReturnQuery): AxiosPromise<OrdersReturnVO[]> => {
    return request({
        url: '/order/ordersReturn/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询单据回访详细
 * @param id
 */
export const getOrdersReturn = (id: string | number): AxiosPromise<OrdersReturnVO> => {
    return request({
        url: '/order/ordersReturn/' + id,
        method: 'get'
    });
};

/**
 * 新增单据回访
 * @param data
 */
export const addOrdersReturn = (data: OrdersReturnForm) => {
    return request({
        url: '/order/ordersReturn',
        method: 'post',
        data: data
    });
};

/**
 * 修改单据回访
 * @param data
 */
export const updateOrdersReturn = (data: OrdersReturnForm) => {
    return request({
        url: '/order/ordersReturn',
        method: 'put',
        data: data
    });
};

/**
 * 删除单据回访
 * @param id
 */
export const delOrdersReturn = (id: string | number | Array<string | number>) => {
    return request({
        url: '/order/ordersReturn/' + id,
        method: 'delete'
    });
};

export default {
    list: listOrdersReturn,
    get: getOrdersReturn,
    add: addOrdersReturn,
    update: updateOrdersReturn,
    del: delOrdersReturn,
}